package com.youdianda.controller;


import com.youdianda.dto.SysConfigDTO;
import com.youdianda.result.Result;
import com.youdianda.service.ISysConfigService;
import com.youdianda.vo.ConfigVO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mosen
 * @since 2023-05-15
 */
@RestController
@RequestMapping("/sys_config")
@Slf4j
public class SysAllController {

    @Autowired
    private ISysConfigService iSysConfigService;

    @Autowired
    private ISysConfigService sysConfigService;
    /**
     * 获取配置数据
     * @return
     */
    @GetMapping("/all")
    @ApiOperation("获取配置数据")
    public Result getAll(){
        return iSysConfigService.getAll();
    }

    /**
     * 修改配置文件
     * @param dto
     * @return
     */
    @PostMapping("/update")
    public Result updateSysConfig(@RequestBody List<SysConfigDTO> dto){
        sysConfigService.updateSysConfig(dto);
        return Result.success("修改成功");
    }
}
